//
//  textFieldView.m
//  AiShangJinFuSalesman
//
//  Created by AiShangTong on 2017/6/6.
//  Copyright © 2018年 AiShangTong. All rights reserved.
//

#import "textFieldView.h"

@interface textFieldView ()

@property (nonatomic, strong) UIImageView *lineImageView;

@end


@implementation textFieldView

- (UIImageView *)lineImageView {
    
    if (!_lineImageView) {
        _lineImageView = [[UIImageView alloc] init];
        _lineImageView.backgroundColor = ThemeMaoLineColor;
        _lineImageView.layer.cornerRadius = 0.25;
        _lineImageView.layer.masksToBounds = YES;
        [self addSubview:_lineImageView];
    }
    return _lineImageView;
}


- (MSQTextField *)writeTextField {
    
    if (!_writeTextField) {
        _writeTextField = [[MSQTextField alloc] init];
        
        _writeTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
        [self addSubview:_writeTextField];
    }
     return _writeTextField;
}

- (instancetype)init {
    
    self = [super init];
    
    if (self) {
        
        
        //设置底部线条
        [self.lineImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.left.mas_equalTo(self.mas_left);
            make.right.mas_equalTo(self.mas_right);
            make.bottom.mas_equalTo(self.mas_bottom);
            make.height.equalTo(@0.5f);
        }];
        
        
        
        //设置输入框
        [self.writeTextField mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.right.mas_equalTo(self.mas_right);
            make.left.mas_equalTo(self.mas_left);
            make.bottom.mas_equalTo(self.mas_bottom);
            make.height.mas_equalTo(50);
        }];
        
        [self bringSubviewToFront:self.lineImageView];
    }
    
    return self;
}










/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
